import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import StartVue from '@/views/Start.vue'
import TeacherVue from '@/views/Teacher.vue'
import TeacherApply from '@/views/teacher/TeacherApply.vue'
import TeacherFix from '@/views/teacher/TeacherFix.vue'
import TesterVue from '@/views/Tester.vue'
import TesterSettle from '@/views/tester/TesterSettle.vue'
import StudentVue from '@/views/Student.vue'
import StudentApply from '@/views/student/StudentApply.vue'
import SystemVue from '@/views/System.vue'
import ExpermentArrange from '@/views/system/ExpermentArrange.vue'
import SessionManage from '@/views/system/SessionManage.vue'
import UserManage from '@/views/system/UserManage.vue'
import ApplyExamin from '@/views/system/ApplyExamin.vue'
import ArticleCategoryVue from '@/views/article/ArticleCategory.vue'
import ArticleManageVue from '@/views/article/ArticleManage.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'


//定义路由关系
const routes = [
    { path: '/', component: StartVue },
    { path: '/login', component: LoginVue },
    {
        path: '/', component: LayoutVue,redirect:'/article/manage', children: [
            { path: '/article/category', component: ArticleCategoryVue },
            { path: '/article/manage', component: ArticleManageVue },
            { path: '/user/info', component: UserInfoVue },
            { path: '/user/avatar', component: UserAvatarVue },
            { path: '/user/resetPassword', component: UserResetPasswordVue }
        ]
    },
    {
        path: '/', component: TeacherVue,redirect:'/teacher/apply', children: [
            { path: '/teacher/apply', component: TeacherApply },
            { path: '/teacher/fix', component: TeacherFix },
        ]
    },
    {
        path: '/', component: TesterVue,redirect:'/tester/settle', children: [
            { path: '/tester/settle', component: TesterSettle },
        ]
    },
    {
        path: '/', component: StudentVue,redirect:'/student/apply', children: [
            { path: '/student/apply', component: StudentApply },
        ]
    },
    {
        path: '/', component: SystemVue,redirect:'/system/session', children: [
            { path: '/system/session', component: SessionManage },
            { path: '/system/user', component: UserManage },
            { path: '/system/experment', component: ExpermentArrange },
            { path: '/system/examin', component: ApplyExamin },
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
